<%@ page language="java"  pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>新增友情链接</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<LINK href="resource/css/admin.css" type="text/css" rel="stylesheet">
    <script type="text/javascript">
        function  checklink(){
            String.prototype.trim=function(){
                 return this.replace(/(^\s*)|(\s*$)/g, "");
            }
             var  name=document.getElementById("name").value;
             var  userName=name.trim();
             if(userName==""){
                 alert("请填写链接名称");
                 return false;
             }
             if(userName.length<2 || userName.length>10 ){
                 alert("链接名称的长度应大于2 小于20");
                 return false;
             }
               var  url=document.getElementById("url").value;
             var  urlvalue=url.trim();
             if(urlvalue==""){
                 alert("请填写链接地址");
                 return false;
             }
             if(urlvalue.length<2 || urlvalue.length>10 ){
                 alert("链接地址的长度应大于2 小于20");
                 return false;
             }else{
             	if(urlvalue.indexOf("http://")==-1){
             		alert("链接地址格式错误");
                 return false;
             	}
             }
             var  orderNum=document.getElementById("orderNum").value;
             if(orderNum==""){
                 alert("请填写序号");
                 return false;
             }else{
                if(isNaN(orderNum)){
                   alert("请输入数字");
                   return  false;
                }
             }
             return true;
             
        }
    
    </script>
  </head>
  
  <body>
       <div align="center">
        <form action="<%=basePath%>/link/add.shtml" method="post" onsubmit="return checklink() ">
           <table>
             <tr><td>链接名称：</td><td><input type="text" id="name" name="link.name"/></td></tr>
             <tr><td>链接url：</td><td><input type="text"  id="url"  name="link.url"/></td></tr>
             <tr><td>logo url：</td><td><input type="text" name="link.logoUrl"  id="logoUrl"/></td></tr>
              <tr><td>序&nbsp; 号 ：</td><td><input type="text" id="orderNum" name="link.orderNum"/></td></tr> 
               <tr align="center"><td align="center" colspan="2"><input type="submit" value="保存" />&nbsp;&nbsp;<input type="reset" value="重置"/></td></tr> 
           </table>
        
        </form>
       </div>
  </body>
</html>
